'''
@Author: Zhengkun Tian
@Email: zhengkun.tian@outlook.com
@Date: 2020-04-29 20:40:43
@LastEditTime: 2020-04-29 21:39:45
@FilePath: \OpenASR\tools\prepara_vad.py
'''
import sys

text_in = sys.argv[0]
text_out = sys.argv[1]

BLK = '1'
NONBLK = '0'

with open(text_in, 'r') as fr:
    with open(text_out, 'w') as fw:
        for line in fr:
            parts = line.strip().split()
            idx = parts[0]
            tokens = []
            for token in parts[1:]:
                if token == BLK:
                    tokens.append(BLK)
                else:
                    tokens.append(NONBLK)

            fw.write(idx+' '+' '.join([tokens])+'\n')